#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
stack<int> num;
stack<char> op;

void eval() {
	auto b = num.top(); num.pop();
	auto a = num.top(); num.pop();
	auto c = op.top(); op.pop();
	int x;
	if (c == '+') x = a + b;
	else if (c == '-') x = a - b;
	else if (c == '*') x = a * b;
	else if (c == '/') x = a / b;
	num.push(x);
}

signed main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	string s; cin >> s;
	map<char, int> pr{{'+', 1}, { '-',1 }, { '*',2 }, { '/',2 }};
	for (int i = 0; i < s.size(); i++) {
		if (isdigit(s[i])) {
			int x = 0, j = i;
			while (j < s.size() && isdigit(s[j])) {
				x = x * 10 + (s[j] - '0');
				j++;
			}
			i = j - 1;
			num.push(x);
		}else if (s[i] == '(') {
			op.push(s[i]);
		}else if (s[i] == ')') {
			while (op.top() != '(') eval();
			op.pop();
		}else {
			while (op.size() && op.top() != '(' && pr[op.top()] >= pr[s[i]]) eval();
			op.push(s[i]);
		}
	}
	while (op.size()) eval();
	cout << num.top() << endl;
	return 0;
}